﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ItemManagement.ascx.cs"
    Inherits="WebUI.UserControls.ItemManagement" %>
<div style="margin:0 0 5 0">
<asp:LinkButton runat="server" Text="Thêm" ID="lnkAdd" Font-Size="10pt" 
           onclick="lnkAdd_Click"></asp:LinkButton>
</div>

<div>
<asp:GridView ID="grvItem" runat="server" AutoGenerateColumns="false" Width="50%"
    OnRowCreated="grvItem_RowCreated" OnRowCommand="grvItem_RowCommand" OnPageIndexChanging="grvItem_PageIndexChanging"
    OnRowDataBound="grvItem_RowDataBound">
    <Columns>
        <asp:TemplateField>
            <ItemStyle Width="16" />
            <ItemTemplate>
                <input type="checkbox" name="chkSelect" />
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField HeaderText="ID" DataField="ID" Visible="false" />
        <asp:BoundField HeaderText="Tên" DataField="Name" />
        <asp:TemplateField>
            <ItemStyle HorizontalAlign="Center" Width="50" />
            <ItemTemplate>
                <div style="font-size: 8pt;">
                    <asp:LinkButton runat="server" ID="lnkEdit" Text="Sửa" CommandArgument='<%# Eval("ID") + ";" + Eval("Name") %>'
                        CommandName="EditItem"></asp:LinkButton>
                    <asp:LinkButton runat="server" ID="lnkDelete" Text="Xóa" CommandArgument='<%# Eval("ID")%>'
                        CommandName="DeleteItem"></asp:LinkButton>
                </div>
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        <div class="message">
            Không có dữ liệu.
        </div>
    </EmptyDataTemplate>
</asp:GridView>
</div>

<div runat="server" style="display: none;margin: 20 0 0 0;" id="divAction">
    <table cellpadding="2" cellspacing="2">
        <tr>
            <td>Tên</td>
            <td>&nbsp;</td>
            <td>
                <asp:TextBox runat="server" ID="txtName" Width="200"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td colspan="3" align="right">
                <asp:Button runat="server" ID="btnAction" Text="" Width="60" OnClick="btnAction_Click" />
            </td>
        </tr>
    </table>
</div>

<script language="javascript" type="text/javascript">
    function selectAll(id)
        {
            var value=document.getElementById(id).checked;
            var chkGroup = document.getElementsByName('chkSelect');
            for(i=0;i<chkGroup.length;i++)
            {
                chkGroup[i].checked=value;
            }
        }
</script>

